package net.wanho.util;

import cn.hutool.crypto.digest.MD5;
import net.wanho.constant.UserConstant;
import org.apache.shiro.crypto.hash.Md5Hash;

/**
 * Author：汤小洋
 * Date：2023-07-27 13:41
 * Description：密码加密工具类
 */
public class PwdUtils {

    /**
     * 加密
     * @param source
     * @param salt
     * @param hashIterations
     * @return
     */
    public  static String encrypt(String source,String salt, int hashIterations){
        return new Md5Hash(source,salt,hashIterations).toHex();
    }

    /**
     * 加密
     * @param source
     * @return
     */
    public  static String encrypt(String source){
        return new Md5Hash(source, UserConstant.SALT , UserConstant.HASHITERATIONS).toHex();
    }

    public static void main(String[] args) {
        System.out.println(encrypt("123"));
    }
}
